import { sendGetJsonRequest, sendPostRequest } from "@/utils/requestEx";

export async function fetchOverview(params: any) {
  const { systemCode } = params;
  const endPointURI = `/dev/dashboard/overview/${systemCode}`;
  return sendGetJsonRequest(endPointURI, params);
}

export async function fetchStatisticOfLastWillPrd(params: any) {
  const { systemCode } = params;
  const endPointURI = `/dev/dashboard/lastWillPrd/${systemCode}`;
  return sendGetJsonRequest(endPointURI, params);
}

export async function fetchStatistics(params: any) {
  const { systemCode } = params;
  const endPointURI = `/dev/dashboard/statistics/${systemCode}`;
  return sendGetJsonRequest(endPointURI, params);
}

export async function fetchStatisticOfAlreadyPrd(params: any) {
  const { systemCode } = params;
  const endPointURI = `/dev/dashboard/statistic/alreadyPrd/${systemCode}`;
  return sendGetJsonRequest(endPointURI, params);
}

export async function fetchStatisticOfNotPrd(params: any) {
  const { systemCode } = params;
  const endPointURI = `/dev/dashboard/statistic/notPrd/${systemCode}`;
  return sendGetJsonRequest(endPointURI, params);
}

export async function fetchRankings(params: any) {
  const { systemCode, startDate, endDate } = params;
  const endPointURI = `/dev/dashboard/ranking/${systemCode}`;
  const data = {
    startDate, endDate
  }
  return sendPostRequest(endPointURI, data);
}